export default {
    namespaced: true,
    state: {
        isShowToast: false,
        toastMsg: '提示内容',
        //（success，danger,warning)
        toastType: 'warning',
    },
    mutations: {
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.toastType = payload.type;
                state.toastMsg = payload.title;
            }
        }
    },
    actions: {
        asyncShowToast(context, payload) {
            context.commit("changeIsShowToast", payload);
            setTimeout(() => {
                context.commit("changeIsShowToast", {
                    isShow: false,
                })
            }, 2000);
        }
    }
}